<% layout("/WEB-INF/view/console/skins/skin_2/layout.html", {}) {
%>
<div class="row">
    <div class="col-md-12">
        <div class="widget-container fluid-height clearfix">
            <div class="widget-content padded clearfix">
                <div class='row'>
                    <div class='col-md-12'>
                        <form name="boWebNews_form" id="boWebNews_form" class='form-inline'>
                            <div class='form-group col-md-3' style='margin-top: 10px;'>
 <label title='是否发布' >是否发布：</label>
 <select class="form-control" id="publish" name="publish">
 <option  value="">请选择...</option>
 	<option  value="0">未发布</option>
 	<option  value="1">已发布</option>
 </select>
 </div>
 <div class='form-group col-md-3' style='margin-top: 10px;'>
 <label title='作者'  >作者：</label>
 <input  onkeyup='boWebNewsConsoleGrid.enterToQuery(event);' type='text' class='form-control' id='author' name='author' placeholder=''>
 </div>
 <div class='form-group col-md-3' style='margin-top: 10px;'>
 <label title='来源'  >来源：</label>
 <input  onkeyup='boWebNewsConsoleGrid.enterToQuery(event);' type='text' class='form-control' id='source' name='source' placeholder=''>
 </div>

                        </form>
                    </div>
                </div>
                <div class='row'>
                    <div align="center">
                        <button type='button' class='btn btn-default' id='boWebNewsQuerySearch'>查询</button>
                        <button type='button' class='btn btn-default' id='boWebNewsReset'>重置</button>
                    </div>
                </div>
                 <div id="boWebNewsToolbar" class="btn-group">
                              <button type="button" class="btn btn-default" onclick="consoleOpenWindow('boWebNews','${ctxPath}/console/bo_web_news/add/${newsType!2}','新增')">
                                  <i class="glyphicon glyphicon-plus"></i>
                              </button>
                              <button type="button" class="btn btn-default" onclick='boWebNewsConsoleGrid.delete("id","${ctxPath}/console/bo_web_news/delete");'>
                                  <i class="glyphicon glyphicon-trash"></i>
                              </button>
                 </div>
                     <div class='row'>
                              <div class='col-md-12'>
                                  <table id="boWebNews" data-toggle="table"
                                         data-url="${ctxPath}/console/bo_web_news/json"
                                         data-pagination="true"
                                         data-query-params="boWebNewsLoadParam"
                                         method="post"
                                         data-side-pagination="server"
                                         data-show-refresh="true"
                                         data-show-toggle="true"
                                         data-pagination-loop="false"
                                         data-show-columns="true"
                                         data-toolbar="#boWebNewsToolbar">
                                      <thead>
                                      <tr>
                                           <th data-checkbox="true"></th>
                                            <th data-field='id' data-visible='false'>ID</th>

                                          <th data-sortable='true' data-field='title'>标题</th>
  <th data-sortable='true' data-field='author'>作者</th>
  <th data-sortable='true' data-field='source'>来源</th>
  <th data-sortable='true' data-field='updateTime' data-formatter="consoleTableDateFormat">更新时间</th>
   <th data-sortable='true' data-field='createTime' data-formatter="consoleTableDateFormat">创建时间</th>
  <th data-field='cover' data-sortable='true' data-formatter='boWebNewscoverFormatter'>封面</th>
                                          <th data-field='publish' data-sortable='true' data-formatter='boWebNewspublishFormatter'>是否发布</th>
  <th data-field='id' data-formatter='boWebNewsTableOperate'>操作</th>
 
                                      </tr>
                                      </thead>
                                  </table>
                              </div>
                     </div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
     var boWebNewsConsoleGrid =new consoleGrid({table_id:"boWebNews"});
     boWebNewsConsoleGrid.init();
     function boWebNewsTableOperate(value){
         return "<button type='button' class='btn btn-xs btn-default command-edit' onclick='consoleOpenWindow(\"boWebNews\",\"${ctxPath}/console/bo_web_news/edit?id="+value+"\",\"编辑\")'><span class='glyphicon glyphicon-pencil'></span></button> ";
     }
    function boWebNewsLoadParam(params){
        params.query=boWebNewsQueryString();

        return params;
    }
     function boWebNewsQueryString() {
         var objQuery = new Object();
         objQuery.title=$('#title').val()==''?null:$('#title').val();
         objQuery.publish=$('#publish').val()==''?null:$('#publish').val();
     objQuery.author=$('#author').val()==''?null:$('#author').val(); 
     objQuery.source=$('#source').val()==''?null:$('#source').val(); 
     objQuery.content=$('#content').val()==''?null:$('#content').val();
     objQuery.newsType="${newsType!2}";
         var queryString = JSON.stringify(objQuery);
         return queryString;
     }

     function boWebNewspublishFormatter(value) 
   { 
       var showValue=''; 
       switch(value+''){
       case '0': 
       showValue = '未发布';
       break;
       case '1': 
       showValue = '已发布';
       break;
       }
    if(showValue.indexOf('不')!=-1||showValue.indexOf('否')!=-1||showValue.indexOf('禁')!=-1){    
       return '<span class="label label-warning">'+showValue+'</span>';
   }else{
       return '<span class="label label-info">'+showValue+'</span>';
   }
   }
       function boWebNewscoverFormatter(value) 
       { 
         return '<a href="'+value+'" target="_blank" > <img style="height:50px;" src="'+value+'" alt="缩略图"> </a>';
       }

 </script>
<%} %>
 